import request from '@/utils/request'
import { Dictionary } from '@/interface/Basic'

// 工序页面
// 获取工序列表
export function GetProcedureList(ManufacturingNO: string) {
  return request({
    url: 'api/MainInterface/GetMainInterfaceProcStatus',
    method: 'get',
    params: { ManufacturingNO }
  })
}
// 上报工序
// 获取上报选项
export function GetReportOptions(params: { Number: string; DatabaseLabel: string }) {
  return request({
    url: 'api/InitialProcess/GetProcessList',
    method: 'get',
    params
  })
}
// IP上报接口
export interface ReportType {
  Id: string
  Status: string
  Bore: string
  Number: string
  Cutting: string | null
  DatabaseLabel: string
  Process: string
}
export function ReportProcedureData(data: ReportType) {
  return request({
    url: 'api/InitialProcess/IdReport',
    method: 'post',
    data
  })
}
// 重置工序
export function ResetProcedure(params: { Procname: string; Number: string; Operator: string }) {
  return request({
    url: 'api/MainInterface/ResetMainInterface',
    method: 'get',
    params
  })
}
// 关闭工序
export function CloseProcedure(params: { Procname: string; Number: string; Operator: string }) {
  return request({
    url: 'api/MainInterface/CloseMainInterface',
    method: 'get',
    params
  })
}

// 具体工序
export interface ProcedureRecordType {
  Number: string
  CuttingNumber: string
  DatabaseLabel: string
}
// 记录表模块
// 获取记录模块
export function GetProcedureRecordList(data: ProcedureRecordType) {
  return request({
    url: 'api/InitialProcess/InitialDataRefresh',
    method: 'post',
    data
  })
}
// 查询记录数据
export function GetProcedureRecordData(data: { id: string; DatabaseLabel: string }) {
  return request({
    url: 'api/InitialProcess/InitialDataQuery',
    method: 'post',
    data
  })
}
// 新建记录接口
export function CreateProcedureRecord(data: ProcedureRecordType) {
  return request({
    url: 'api/InitialProcess/InitialDataAdd',
    method: 'post',
    data
  })
}
// 保存记录接口
export function UpdateProcedureRecord(data: Dictionary<string | Dictionary<string>>) {
  return request({
    url: 'api/InitialProcess/InitialDataUpdate',
    method: 'post',
    data
  })
}
// 删除记录接口
export function DeleteProcedureRecord(data: { id: string; DatabaseLabel: string }) {
  return request({
    url: 'api/InitialProcess/InitialDataRemove',
    method: 'post',
    data
  })
}
// 记录表权限获取接口
export function GetProcedureButtonLimit(data: { SeNumber: string; DatabaseLabel: string }) {
  return request({
    url: 'api/InitialProcess/ProcessLimit',
    method: 'post',
    data
  })
}

// 初装模块
export function GetComboxList(params: { Number: string }) {
  return request({
    url: 'api/InitialProcess/GetComboxList',
    method: 'get',
    params
  })
}
// 声延时模块
export function AAA_ComputeByFormula(data: Dictionary<string>) {
  return request({
    url: 'api/AAA/Counter',
    method: 'post',
    data
  })
}
export function AAB_ComputeByFormula(data: Dictionary<string>) {
  return request({
    url: 'api/AAB/Counter',
    method: 'post',
    data
  })
}
export function AAC_ComputeByFormula(data: Dictionary<string>) {
  return request({
    url: 'api/AAC/Counter',
    method: 'post',
    data
  })
}
// 声延时模块 - 计算两端总长
export function AAC_2_ComputeByFormula(data: Dictionary<string>) {
  return request({
    url: 'api/AAC/Counter_',
    method: 'post',
    data
  })
}
export function AAD_ComputeByFormula(data: Dictionary<string>) {
  return request({
    url: 'api/AAD/Counter',
    method: 'post',
    data
  })
}
